<template>
  <div class="child-demo">
    <h3>👶 子组件（点击发送消息给父组件）</h3>
    <button @click="sendMsg">发送消息</button>
  </div>
</template>

<script setup>
import { defineEmits } from 'vue'

const emit = defineEmits(['msg-from-child'])

function sendMsg() {
  emit('msg-from-child', '🎉 儿子给老子发消息啦！')
}
</script>

<style scoped>
.child-demo {
  border: 2px dashed #007bff;
  padding: 15px;
  margin: 10px 0;
  border-radius: 8px;
}
</style>
